import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';
import 'package:flutter_ability_example/navigation/appbar/appbar_page.dart';
import 'package:flutter_ability_example/navigation/tabs/tabs_page.dart';

class NavigationPage extends StatefulWidget {
  const NavigationPage({Key? key}) : super(key: key);

  @override
  State<NavigationPage> createState() => _NavigationPageState();
}

class _NavigationPageState extends State<NavigationPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("导航"),
      ),
      body: Container(
        padding: const EdgeInsets.only(left: 16, right: 16, top: 20),
        child: buildCenter(context),
      ),
    );
  }

  buildCenter(BuildContext context) {
    return Column(
      children: [
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const AppBerPage();
            }));
          },
          text: "导航栏",
          color: YJColors.NOTICE,
          textColor: Colors.white,
        ),
        const SizedBox(height: 10),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const TabsPage();
            }));
          },
          text: "底部TAB",
          color: YJColors.SUCCESS,
          textColor: Colors.white,
        ),
      ],
    );
  }
}
